<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/4/17 0017
  Time: 22:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="./CSS/style.css" />
    <script src="js/jquery.js"></script>
</head>

<body >
<div id="wrapper">
    <div class="aw-login-box">
        <div class="box-bg-ys"></div>
        <div class="mod-body clearfix">
            <div class="content pull-left">
                <h1 class="logo"><a href=" https://lol.qq.com/"></a></h1>
                <form  method="get" action="/checkServlet">
                    <ul>
                        <li>
                            <input type="text" id="aw-login-user-name" class="form-control" placeholder="用户名" name="user_name">
                        </li>
                        <li>
                            <input type="password" id="aw-login-user-password" class="form-control" placeholder="密码" name="password">
                            <br>
                            <span id="repasser" style="color: crimson;" ></span>
                        </li>
                        <li class="last">
                            <input  type="submit" class="pull-right btn btn-large btn-primary" id="sign" value="登录">
                            <label>
                                <input type="checkbox" value="1" name="net_auto_login">
                                记住我							</label>
                          <a href="javascript:;">忘记密码</a>
                        </li>
                    </ul>
                </form>
            </div>
            <div class="side-bar pull-left">
                <h3>第三方账号登录</h3>
                <a href="user.jsp" class="btn btn-block btn-weibo"><i style="margin-left: 2px;margin-top: 1px;width: 35px;height: 35px"> <img src="icon/dgut.png" width=35px;height=35px /></i>  莞工中央登录</a>
                <a href="javascript:;" class="btn btn-block btn-qq"> <i style="margin-left: 3px;margin-top: 1px;width: 35px;height: 35px"> <img src="icon/wechat.png" width=35px;height=35px /> </i> 微信登录</a>
            </div>
        </div>
        <div class="mod-footer">
            <span>还没有账号?</span>
            <a href="/register.jsp">立即注册</a>
            <a href="/error.jsp">游客访问</a>
        </div>
    </div>
</div>
</body>
</html>
<script>
    $(document).ready(function(){
        $("#aw-login-user-password").blur(function () {
            console.log("aaa");
            var user_name= $("#aw-login-user-name").val();
            var password = $("#aw-login-user-password").val();
            var param = {
                user_name:user_name,
                password: password,
            };
            $.get("/check-login",param,function (data) {

                var f = data.flag;
                console.log(f);
                if(f==1){
                    $("#repasser").html("");
                }
                else if(f==2){
                    alert("该用户不存在！");
                }
                else{
                    $("#repasser").html("密码错误,请重新输入！");
                }
            });
        });

    });
</script>